#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif

#define PCM8_MAX UINT8_C(0x7F)
#define PCM8_MIN UINT8_C(0x80)
#define PCM16_MAX UINT16_C(0x7FFF)
#define PCM16_MIN UINT16_C(0x8000)
#define PCM24_MAX UINT32_C(0x7FFFFF)
#define PCM24_MIN UINT32_C(0x800000)
#define PCM32_MAX UINT32_C(0x7FFFFFFF)
#define PCM32_MIN UINT32_C(0x80000000)

#define ERR(n, r)		\
	do {			\
		errno = (n);	\
		return (r);	\
	} while (0)

struct a_lookup {
	const char *string;
	int value;
};

void	 auconvp(struct au *, uint32_t, void *, size_t);
ssize_t	 a_lookup(const struct a_lookup *, const char *, int *);
int	 setblock(int, int);
uint32_t get4(const void *);
void	 put4(void *, uint32_t);
ssize_t	 nread(int, void *, size_t);
ssize_t	 nwrite(int, const void *, size_t);
size_t	 szwrite(char *, size_t, const char *, const char *);
size_t	 strtosz(const char *);
uint32_t strtou32(const char *);
ssize_t	 memacat(void **, size_t *, void *, size_t);
